<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>求和函数</title>
    <script type="text/javascript">
       function sum(){
           var a=0;
           for(i=10;i<=100;i++){
               a=a+i;

           }
           document.getElementById("result").value=a;
       }
    </script>
</head>
<body>
    <input type="button" onclick="sum()" value="计算";>
    <span><input type="text" id="result"></span>

    
</body>
</html>